package com.team.controller;

import com.team.service.AppointmentService;
import com.team.service.ManaginePrivilegesService;
import com.team.vo.AppointmentMessage;
import com.team.vo.PersonalInformation;
import com.team.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author keluoyisi
 * @program: seven
 * @description: 患者预约
 * @date 2022-10-19 16:51:24
 */
@Controller
@ResponseBody
@RequestMapping("/AppointmentController")
public class AppointmentController {
    @Autowired
    private AppointmentService appointmentService;

    /**
     * @param :
     * @return Result
     * @description 显示所有部门以及对应的科室
     */
    @RequestMapping("/selectDeptSection")
    public Result selectDeptSection(){
        return appointmentService.selectDeptSection();
    }

    /**
     * @param :
     * @return Result
     * @description 得到科室的id并且存在session中
     */
    @RequestMapping("/addSectionId")
    public Result addSectionId(int id){
        return appointmentService.addSectionId(id);
    }


    /**
     * @param appointmentMessage:
     * @return Result
     * @description 预约数量加1
     */
    @RequestMapping("/addVisitCount")
    public Result addVisitCount(@RequestBody AppointmentMessage appointmentMessage){
        return appointmentService.addVisitCount(appointmentMessage);
    }

    /**
     * @param personalInformation:
     * @return Result
     * @description 接收个人信息，创建预约订单
     */
    @RequestMapping("/toRegistration")
    public Result toRegistration(@RequestBody PersonalInformation personalInformation){
        return appointmentService.toRegistration(personalInformation);
    }

    /**
     * @param :
     * @return Result
     * @description 预约数量减1
     */
    @RequestMapping("/cancel")
    public Result cancel(){
        return appointmentService.cancel();
    }
}
